package com.mck.mapper;

import com.mck.entity.OperLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OperationLogMapper{

    /**
     * 保存操作日志
     */
    @Insert("insert into operation_log(user_id, method, url, params, ip, address, create_time, time_cost) values(#{userId}, #{method}, #{url}, #{params}, #{ip}, #{address}, #{createTime}, #{timeCost})")
    void insertOperationLog(OperLog operationLog);

    /**
     * 获取用户操作日志
     */
    @Select("select * from operation_log where user_id = #{userId} order by create_time desc")
    List<OperLog> getOperationLogList(Integer userId);
}